﻿using AccustomeAttributedll;
using AixCommInfo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;


namespace FinalTestMachine.View.Dispenser
{
    /// <summary>
    /// UserControl_ExtralViewTable.xaml 的交互逻辑
    /// </summary>
    public partial class UserControl_ExtralViewTable : UserControl
    {
        public UserControl_ExtralViewTable()
        {
            InitializeComponent();
            IUserLimitdll.PreControlBindingHelper.SetLitmitBinding(gd_1, IUserLimitdll.UserLevelModes.ModifyAndOperation);

            //SetParam(Aix_XYZ_StandardPointMsg.Cur);
           
        }

        //void SetParam(Aix_XYZ_StandardPointMsg otherParamHelper)
        //{
        //    //添加位置组件
        //    int RowIndex = 0;//一开始时为0
        //    Type type = otherParamHelper.GetType();
        //    var propertyInfos = type.GetFields(BindingFlags.Instance | BindingFlags.Public).Where(s => !s.IsInitOnly && s.IsDefined(typeof(TextBoxRemarkAttribute), true));
        //    foreach (var vr in propertyInfos)
        //    {

        //        if (vr.FieldType.Name == typeof(ParamStructText<>).Name)
        //        {


        //            object singleMsgSource = vr.GetValue(otherParamHelper);
        //            //获取位置信息标识
        //            TextBoxRemarkAttribute paramRemarkAttribute = (TextBoxRemarkAttribute)vr.GetCustomAttributes(typeof(TextBoxRemarkAttribute), true)[0];
        //            //添加行
        //            RowDefinition rowDefinition = new RowDefinition();
        //            rowDefinition.Height = GridLength.Auto;
        //            grd_AixStandardParam.RowDefinitions.Add(rowDefinition);

        //            RowIndex = grd_AixStandardParam.RowDefinitions.IndexOf(rowDefinition);

        //            LanguageControlBase.Wpf.LanTextBlock textBlock = new LanguageControlBase.Wpf.LanTextBlock();
        //            string tempRemark = paramRemarkAttribute.GetRemark();
                    
        //            //if (!tempRemark.Contains(':'))
        //            //{
        //            //    tempRemark = tempRemark + "：";
        //            //}

        //            textBlock.LanText = tempRemark;
        //            textBlock.FontSize = 15;
        //            grd_AixStandardParam.Children.Add(textBlock);
        //            textBlock.HorizontalAlignment = HorizontalAlignment.Right;
        //            textBlock.VerticalAlignment = VerticalAlignment.Center;
        //            Grid.SetRow(textBlock, RowIndex);
        //            Grid.SetColumn(textBlock, 0);

        //            //添加输入框
        //            TextBox textBox = new TextBox();
        //            textBox.Height = 25;
        //            textBox.Width = 100;
        //            textBox.FontSize = 15;
        //            textBox.Margin = new Thickness(0, 5, 5, 5);
        //            textBox.VerticalContentAlignment = VerticalAlignment.Bottom;
        //            grd_AixStandardParam.Children.Add(textBox);
        //            Grid.SetRow(textBox, RowIndex);
        //            Grid.SetColumn(textBox, 1);
        //            //绑定
        //            Binding binding = new Binding();
        //            binding.Source = singleMsgSource;
        //            binding.Path = new PropertyPath("GetValue");
        //            binding.UpdateSourceTrigger = UpdateSourceTrigger.LostFocus;
        //            textBox.SetBinding(TextBox.TextProperty, binding);

        //        }
        //    }

        //}
    }
}
